Rewriting for flexibility
Working on proper state translation