Woops

Accidentally copy and pasted the first version of the code, not the updated rewrite! Here's the actual updated version!