incorporated suggestions by mleibman