Moved functions around so they are separated by "functionality".