Add utility functions for parser, replace while with for loop because I completely forgot what language I was using for a second