Slight update to return a json and account for error when count isn't provided