better code structure in twitter api