Added the first part of function.  Probably needs something on loops