added the InitNewWindow function