add comments, fix deviceready event bug