Almost ready to put in the last bit of logic for this