main app in M. Hartl's book