Refactored the internal structure