modified homspace coords functions, making more efficient using Karim's trick