#408 Improve code