misc extra refactoring