added rectangle and fixed inheritance