completed script for tidy data