My first attempt at making this lib advanced compilation friendly.
I think this advanced compiles now