still one little bug with the unique code, but all the rest is working just fine