- refactored into functions