refactor unnecessary if condition and make sequence id optional