Fix various code placements