Added check for layer so it doesn't get clobbered.  For now just throw an exception if layer exists.