cleaning up and refactoring mapping