Added input validation for numbers and cleaned some stuff up