implementing some CS stuff as a refresher