cleanup of if else block