fix segfault (stale pointer), overhaul viewport management (inc reduction to int16_t), remove unnecessary locks (performance improvements)