percentage made into function