Fixing the not changing position due to passing by value