* fixed spelling mistakes
* refactored functionality into functions that make sense