Fixed some errors. Added "new window" support.