Added spike algorithm for figuring out orientation