added ip logging and input sanitization