Reduced the number of conditions for certain functions to reduce the cyclomatic complexity of the functions.