Cleanup session code