Logic fix

The logic of how to handle limit and batch size was broken, i.e. the amount of actual elements shown in the batch and total batches were incorrect. This has been fixed in this pull request.

Further on some pep8 details has been corrected.

Tests are verified.