Major overhaul of file and code structure