Added inline documentation - a lot :)