added documentation tags and formatted code