Reworked our main check into a function instead. Put it in a loop.
Added in KV parsing and some other cleanup things. This should probably have been multiple commits.