Added documentation and in line comments to functions. Also created query functions specific to each category