Coding cleanup phase 1