refactored conditionals

Changed conditionals across different files to improve code readability