cleaning up, refactoring map into directive