Significantly clean up code