Hmm, is there a more efficient way of implementing this?