Moved all the code from ipp to header