checks for input length, improved formatting