Added logging and fixed messages format