Overhaul of building placement code