self upgrade skeleton and some small fix and refactor

self upgrade skeleton and some small fix and refactor