Updated to use magic