Fixed veriables in new function