added input validation function, timing function, and made the UI more friendly