Logic and if statement cleanup