Added a little checking on input