Reworked index added errorhandler