Massive refactor of twitter api helper code