Error handling complete. Bug fixes