major rehaul of all bad code