Tidied up esh.c a little more