wip

split code into common and library specific
begin work for babylon
write some unittests