added junit tests; cleanup