Simplified codes with __import__ function and some other minor refactori...

...ng.