Cleaned up common code between the ale_interface and main.