Adds Session functions, syntax fixes and tweaks