Refactoring types(remove records and now use plain maps)