Added try catch for retrieving prefix from list