improving logging and performance