A couple of small modifications are made. Also more comments and logs are added.