added logging in/out functions