Code cleanup and applied marker folding