Refactored. Not using tab() in this version