Refactored codes