refactored a bit so twarc can be used as a library and added some tests