wrote function for calculating modifiers
updated function