Adding window base and reusable function