Further re-factoring and comments