fix map function
clean up code
clean up codes