Fixed extraction operation.
Use templates instead of macros.