Adding session support

Simple session with checks to improve security.