getattr and setattr added in place of string formatting