More commenting and fixing of functions