First part of code.