readded error handling