updated phash method