move $_SESSION references around
Add vendor enum
Various cleanup