Modified sleep and wakeup methods
Updated to reflect changes in the cpp
Modified to prevent future errors