added dynamic sort while voting