Refactor extra functions into static library