from line 8 to line 39: redundant tests!