General code consistency fixes