Removed test function. Added limit parameter