Variables Clean Up

Cleaning up result array to prevent memory leaks and to make function more stable
Removed unnecessary comments