added second part of the loader handling code and few tests