This must be a better way of doing this