Replacing a 50ms DELAY with tsleep