Added a lot of comments and changed AV names to be more meaningful.