Fixed mapping results objects with a quick function, and moved around some code.