added reference and more comments