Split project into library + executable and started writing some tests.