Do this in a better way