Cleanup

Cleaned up some code and arranged files in managed way.