some minor cleanup as well as implementing some APIs