Moved more code into private methods.