Cleaned up the code and added unicode exception