refactor some code and add days_left