noob mistakes refactored