move Session to Sessions, general cleanup
move more SQL out of junk
get rid of trim_array