updated first part answer