Commented code, made minor aesthetic changes