added viewwindow functionality and other shit too