logging and input validation