refactor to make it actually work!