working version for int and string