Any way to split it into two functions for clarity incase the other use case is ever needed?