better org of h files and CHECK_ERROR macro