token parsing improved