Base code with tests