updated analyzeCode to use prototypes, cleared up memory leak