refactored code and added some complexity
Merge pull request #1 from ArthurGibbs/waveychange

refactored code and added some complexity