initial refactor (not yet tested)
fix bugs
fix votes
remove vardump
Merge pull request #1 from x89/refactor

[WIP] Refactoring