added support for max number of entries to be shown