Code with comments after integrating with Ashley