Added support for up to 3 buttons