Fixed bug in single code on refresh; Refactored code directives in a separate file.