Added more detailed code documentation