Cleaned code for vote restriction