ReFactored some old code to avoid using for and while loops.
USe some of underscores functions