moved session statement after api calls and collapse tests