code reassemble by Hein Win Toe