clean up some messy internals + add static factories