sorted out the input validation and logging properly