updated log messages
removed duplicated code