this could possibly be moved into a function as it occurs twice.