Fixed if/else, added test