Cleanup the horrible code