Fixed up structure of code. Removed useless string cast.