Code improvements

* There was a bug when naming modules
* Added ResourceLoader#exists
* Reduce visibility for internal classes
* Add more tests
* Code clean up