Refactor code
Add comments