ver 2

added logging function