layer_map code refactored a bit (now it should be pep8-compliant