Implement more duplicate checks

Also use the new status codes from the library for more defined error
handeling