Cleaned up some Entity code.