hookup code to button. fixed bug.