clean up structure, provide isolated external resource and rule for current implementation, write tests