improved Program9 code