refactor to use validation with buffer