button prevent default + code optimizations