Reverted pull request #6

Refactor broke functionality. Need to identify the issues.