added writelnattr, and some macros.