Some tests and useful functions