added a lot of actual functionality