Performance improvements and addition of limits parameter.