Adding init and preventing invalid hash