move more functions into the 'library'