Restructure the main library file
Simplify the unit tests