cleaned up some dirty code