Added checks for user input in gui