Moved tokens parsing out to function a slightly better error reporting