Wrote much of the core functionality