Some changes to make it less rigid, and closer to Apple frameworks coding style.