Create sequence endpoint

Didn't quite  do the whole thing, but the code is cleaned up and there should be less coupling.