Aria2

Add changes made by @TMaster, with some refactor.