Refactoring and basic usage scenario implementaion