added map function and some comments