improved text positioning, fixes, generalization