added try catch to handle malformed input by user