Misc changes: fixed if statements, changed format