added doc and comments