Major code clean up and handling of errors

And fixed a little bug where the item name id wasn't correct but still
working.