added some voting logic