refactored into proper classes from the static Program class