Added validations for inputs. NO MORE CRASHING!