Consolidate SQL, and add in saleman only login checks