More code translated and refactored