pulled out logic