Cleanup and breaking EZdata function into smaller pieces