Added rect class, more refactoring, changed example-