refactored a bit
Merge pull request #7 from kevinchabreck/refactoring

Refactored code