Improved CASAO5 code