Code that works but really needs to be cleaned up