Added basic structure to lua files. However the state machine does not work correctly.