Added some rough function comments