cleaned up, ready to be DLLized