Add commentaries and remove old code