move logic to lib file
privatize methods