Code polishing: object creation at proper place