Implement level loading; also several bug fixes needed for it to work properly.