replaced condition with scope block