Add first unit test; small refactor of Min and Max