Removed console.logs and edited return values

Removed all traces of any console.log functions to make for more
generic, reusable code.  Also tweaked the return values of a few
functions as well as added a line of code to sort the array argument
sent to the array function.