Better handling of if stmt