two mode support: Cluster and Session

This change will help to support returning Cluster object or Session object according to the configuration