inspired (more like copied) by one of my friends
this is basically for him if he wants to peek at the code.