inverting door frame logic