cleaned up, added comments, added tidy data df