Refactor using pimpl idiom