Completed the implementation

completed all implementation. Couple of hours work pending to finalize
the documentation. Also add other comments.