Refactored some strange names and code layout.