added comments and little cosmetical changes