I reject the premise of having had an unreasonable deadline. I would avoid situations where a hard deadline forces the progress of a project. If it's not open heart surgery then it's probably ok to take a few extra days to get things done right. If you are in a job / situation where it's do or die on a deadline, then the problem is not bad code but a bad work environment and I encourage you to find something new.