this if statement and the one below should be merged into a single compound conditional to save space