implementation mostly done, doesn't crash