This is just what I needed! Thanks to Gunnar Hjalmarsson and p-dh, you both have saved me a lot of time and effort.