Partial commit, with code reformatting and couple of console logs addded.