Add CadRect functions; Add some macros; Small fixes.