minor optimization + compact to 76 lines…