fixed prototype bad .map implementation

also cleaned up some formatting