fixing rename and adding rename tests
refactoring into smaller modules and adding jsdocs