First iteration of logic completed and working