large amount of shitty code that almost parses a declaration