added compass algorithm