Writing some utility functions. I'm not sure if my data is structured correctly or not. Still thinking