Refactor: Replace magic numbers with constants for inside/outside