Documentation, re-organizing code