Added dynamic button function

Not completely working