added the ranger and did a bit of refactoring