Intiate function as soon as button is pressed, not loop it over and over.

Oh alright, updated the original post.