Cleaned up some older or unused code. Improved code style in a few places.