removed finalize method and replaced with didFinishPreparingLayout