Speed up algo (a bit), add result object