Cleaned up messy code structures.