update to reduce use of temp variables. hope i like it...