changed context of mapping functions
tidying up