Add unit tests to ensure no side effects