[Updated] Use a better function