Re-orginize the js sequence to avoid button conflicts