Full working version (no deepsleep)