Fixed the use of nanosleep which removed a spinloop and degraded the performance dramatically.
Merge branch 'develop' into MAX-268