Refactor spatial extensions