Added commenting for all functions