Remove trailing whitespace
Consolidate quit check
Remove extra else blocks that are not needed
Don't need to check for keyboard interupt really
Refactor the code a little in order to reduce the ammount of duplicate code
Merge pull request #1 from klusark/master

Improve the code a little
merge