Commented code, made small tweaks