More cleaning and shuffling of code pieces.