better error handling
better hash treatment