Added all the commands previously and adjusted the MySQL function to
return a useful data type