Changed the way the corners are calculated