Improving code slightly and remiving debug statement.