Cleaned up directories and refactored.
Cleaned up directories and factored