Perhaps we should write a convenience function for this as it is copied twice?