starting to clean up some of this code and make it work for us