updated based on @j2sol suggestions