various useful scraps of code