code cleanup + docs