Sorted the whole code

Split into several files, deleted unnecessary files.