engine code tidied