Added error messages for invalid input/added more tests