Less quick-and-dirty fix