1. Bug fix: for rangy
2. Refactoring the code