massive refactor and restyling