code from sameed