Add thread type feature

@jimabramson
I'm not sure, but I generally think it's best to let the database do work for us