Added documentation
Fixed nesting
Added some error handling
Fixed a syntax error in line 212
Added function to check clean target.
Added some more comments and todos