Some changes to not use the scoped session.