Some re-factoring