added more documentation and made callback function name changeable