Refactaring these programs.