getting small set working again
finally fixing my idiot logic, optimizing script, and converting to PHP