Can this be done more efficiently?