Unit tests now pass, some lines will have to change after integration.