Fix a bug
Refactor code