Error handling + more correct use of sse