Added on_pause and on_resume