Refactor command building with Buffer