Fixes for broken endpoints, other code cleanups