fixing some bugs, changing start fragment, reorganize some code