added comments and extra exhaustive testing in JUnits