app turned into library, tests added, Makefile added