adding in rectangle problem
updating algorithm and code based on tests