Added beginning stages of sessioning, code needs cleaning up.