Improving appendHash method