fixed failing junit tests
Minor code cleanup