sapply makes a lot more sense here.