Changed rectangle to class and added constructor