cleanup, enhancements, junit tests