Fixed #9 plus some structural changed