Refactoring and optimize, add support boost::array