Refactor calculations and setProperties