More modifications to function