simplified the mapper function