moving functions around for betterness