refactor macros to library
updated docs
updated todo