Extract methods and remove code