Code cleanup and markup