working, now need to handle invalid input