code cleanup + started documentation