refactored attribute code to be calculation instead of int