reduce internal complexity fix #51