add functionality to display only pissible buttons
refactoring