Added some more dok. Added to and from json. Small fixes on calculation