Performance imporovements & bugfixes