renamed source file, added doc, improved some code