moving onIdle logic to object