Added comments to a bunch of code + caps bugfix

- Fixed [caps proper] not working properly on multi-word query results