Changed handling of buttons