Increase number of instances support added. Refactored test code