Removed UNION and second SELECT from query

Should run much faster.