added user class and reorganised hash methods