a lot of re-factoring