added error checking for empty and non number inputs