function was removed from global space, added preventDefault for button click event