added final changes and comments