added solution without pagination (found the problem with the memory)