final commit. fixed nil bugs.