added code from  mobi-app-dev-in-th- cloud book