improve performance and add window duplication