Added logging and reason phrases