Improved names and comments, removed old code.