Reformad code
Added docs