Code refractoring and documentation