added support for 3 buttons