more precise parsing for java