Fixed if statements within functions constructing. Added the basic structure to allow external files to be loaded.