Refactored structure. Added 'doc' comments for later use.