moved main to lib