refined code; added a logger class