move 'primary.js' - abstraction for interacting with primaries - down to lib/, now it's used by different processes