added a dependancy, cleaned up some code