ex10 code finished. use extra casts