First part of code