some small re-factoring