C++ compiler checks added + Lesser code