some fixes in terms of map

Mainly, make a intermediate function to get the keys we want. 
How about just making this one initMainThread', with the tick.