Added --buffer-size. General refactoring.