implemented buttons and gates
halfway there