Documentation writing and cleanup