Removed sleep and changed deprecated fun