Can we reduce the duplication here?