refactored code

now using tabpane not a panel