Clean up import code. Add comments