Added rect creation funciton and rect initiliazer