Fixed issue with addChildAt not working correctly if there were two children.
clean up code.