added comments and fixed some spacing
error message popped up