changed the macro so that it should work correctly in every situation now.