refactor occupied to return 2 values