Adding tests
Tests for invalid input. Tests naming improved
Unifying valid input check in one function