Amended window handling to custom in code scope