Final implementation and comments