Remove unnecessary part from if/elif statement