finished first implementation of input validation