added limit function to limit the output