refactor; test boundaries