Minor code rearrangements, commenting, couple of todos