Added smartThrow method