seems to be working
cleaned up somewhat