Remove redundant hash for codes from controller (moved to model)