some changes by ct9000_freak