Move entries logic to directive