Better error handling & string parsing