log implementation working but very slow