Completed the first cut code