Changed functions to work with P,L instead of geo