Moving part of the code in library.