Your "mere page and a half of source code" appears to becoming longer and more-complex the more you try to "improve it." Don't try. What you have written is reasonably easy to understand as-is and the computer won't care. Write a test to thoroughly verify that the existing code works, then close the work-order ticket and move on to the next one.