alternative implementation for mapS' added