Added extra instantiation parameter
Made some optimizations