Huge reorganization of code for better readability
Merge branch 'code-reorganization' into develop