Add comments and Refactor