Make it work.

Even though the code is ugly, make it work for now.