implemented update weight method
added hash code
improve redability
improve readability