refactored tweet handling (thanks to noidi)