Refactor tabs directive