Refactoring test classes and rake tasks

Updating lib layout