extract lib functions and change methods to vars