It seems like after I've written a significant amount of code I get this anxious feeling like I haven't done it in the best possible way, and I end up continuously refactoring and spending way too much time on the project, or never getting it done sometimes. Does this ever happen to anyone else, and how do you deal with this?
Does anyone else have a refactoring problem?
code quality;refactoring
I enjoy these moments when they happen to me.The reason: if I did not look back at my work and think there is something I could have done better than I would not be advancing as a developer.  Therefore, when these moments of enlightenment occur, embrace them and take note of what you learned.  Consider your timetable for current project and if possible refactor the code, if not possible take the lesson and use it in future implementations for projects.  Either way, learning from your own mistakes is a great thing!  