Refactor date and some quick fixes