Added some comments and deleted unimportant function