Add an UNREACHABLE define.
Moved context management functions to context.hpp/cpp and added basic error handling functions.