refactored sql that selects, compares, and formulates stats on properties.  reduce the one file by nearly 300 lines, performance is slightly worse, but the trade off for similicity of the code is well worth it