Declare variables and improve circuit