days work

separated functions to lib dir