added logging mechanism and updated test