do this in a better way