fixed some optimizations and added minimal support for map builtin
merge