refactored votes controller