Major Refactoring

Major refactoring of the code, removing silly and extra stuff