Tests refactor and link tests