Add ability to handle invalid input gracefully
Add some edge case handling