got ordered dict instead of regular dict

Also got it to gen/retrieve obs mask only once rather than every time

#fix 139