refactor single, ugly doGet() into smaller, separate subroutines