moved handlers to lib