added duplicate protection & basic error handling