cleaned up tabbar implimentation. Added somments to code for clarity.