Changes to API and Sessions

Sessions converted to a class
Session functions update in the API