Solutions for the first 3 coding questions + some infrastructure