put core functionality into seperate library