Fix/refactor

Replacing old code with calls to the new lib implementation and structure.