more constness and cleanup