merged with upstream
some cleanup