use locals instead of instance variable