Move the external code to library