first working pygame implementation - 50 percent faster