Added some casting macros.
Redesigned warray to be more type safe, faster.