WIP Gigantic refactoring and cleaning...