Modified the code to be in separate files