Refactored Loader and common

Add unit test and comment on common