Added some documentation, renamed some variables.