add a lot of functionality and fix a lot of bugs