modified to enhance code readibility