added implementation to handle buttons