Added (working?) sleep function