implement logic and i/o