Added Thread-Safe macros for proper compilation

Fixes #10