small method refactor so it can be reused