moves rate-limit sleep logicinto function