fixed session and application. added scripts to create and update the database.