Add model for Tweets.
Change Tweet.id to bigint for saving native id's.
Add init method for Tweet model.
Change API method so params can be given easier.
Wrap main code in a function.