Fixed Syntax & Logic Issues

Just fixed some syntax and logic issues.