Added more comments

Added comments for each subroutine in model.m