Refactor and new library files