added substr and change som variable names