Latest code refactoring and attempted integration of doors (not functional yet).