You've to actually measure the cost for maintenance ('if we rewrite it, would it be cheaper and less time consuming than trying to do little fixes on a long term?'). Do your users need the fix or notice the messiness? I think there are three things you have to consider for making a choice: 1. Cost 2. Needs of users 3. Time. If in a long term it would be cheaper and will be faster than doing little patches and bug fixes without affecting the users then you should rewrite but don't throw away all of the code. By now you should know which parts of the code work and which don't. But if it needs to be done quickly for the sake of the startup and users then perhaps you should just try to improve it and when it's safe to do it, rewrite it.