Fixed purity bug in the main function, nlist was extraneous (just a holdover from v1) and conflicted with direct references to state, so I got rid of it