adding log statements so its easy to understand