code refoctored
master_issue_28_d