added some documentation, bux fixed