working version before state button addition