Added a ghost checking thead and tweaked /clearclients to immediately take effect,

Ignore the previous commits, most were tests for stuff which were eventually added to master, and got merged in. So while I did make some changes none have made it to this point except the ghost-checking thread and /clearclients fix.