Start work on extract script for state detection