remove internals visible to for better unit testing; fix unit tests