Added some geometry code