Add define & some fixes.
Add crate lib