Fixing range calculation (minor) bug
Refactoring to reduce dependency between JS components