Adding documentation, fixing bugs