[4.0.0][#461] move primary implementation files to lib/

tests and internal linkages modified