added check to see if an id already exists
added exception for requesting the wrong type