Added back first part of the function and prevent default