Refactored setup method