Implement Code class, refactoring