changing an if to elif to avoid loads of unnecessary warnings