remove the button
functionalize the code