made stuff more robust and added more auto-created indexes