Results are now accessible outside of function scope, removed all memory leaks