move functions around and rename stuff