Fixes my problems--only actual changes are formatting, indentation maybe