Improved error handling + HTML fixes