refactor and optimize HBase implementation