Finished the implementation and commented.