Added engine and a little cleanup