Moved extra functions to library