migrated all functions so they take in a context reference instead of having one bound to them, making them more flexible which should also help out pure function implementation in the future