Final Version

Fixed the bugs.