Add more tests
Add tests and fix calculating resources