Added unit tests to test for corner cases, population cases, and errors