Code tidy up.
Fixed tab activation issue.