clean up, bug fix, added functionality