Refactored for tablets