still needs tests, but tons more functional