Separated library source code from testing code, fixing #6