clean up terrible code