add license header
improve documentation and check code style