Bits and pieces of code cleanup