Adding logic to avoid building datasets every time