Some bugfixing. Proper functioning of buttons.