more robust code