slightly better attribute selection logic but still pretty b0rked

Don't merge yet, mostly here for reference.