Passed last page from context to helper method.
Extracted helper method to create the context.
Removed a redundant return variable.