New code and renaming

Quick rewrite of the code and renaming