cleaned up the setSize function