Optimized some methods

Specifically, the parse function used to iterate over every single
character of the code to parse and would crash on large strings.