adding validation to its own file and fixing the file structure a bit