moved functionality to lib folder