debugged
more robust testing