Added function and cleaned up file structure