Significant refactoring. The file structure used earlier caused problems when executing and compiling code. This fixes that.