Add core library implementation + tests