Add more unit tests, rearrange import code to be more concise.