Added in sleep handler and time handler code