basically implemented all 10 cases of calculating value mappings, needs
clean up and refactoring