Improve #defines and documentation