Refactored resolver and added some tests