Restructured codebase, fixed minor bugs
Merge commit 'b73939330f3a0e27cbf40192654ed557e4617b52'