refactor STS into util ยท apex/apex@097d56d

CC @DavidBlooman hopefully this still works haha