refactoring code to support cdh3u6