Refactored code... getting ready to work on #8 and #9