fixed bug, added a bit of functionality