re copied the code since it was not working