Made the initial code even uglier and remove boost dependencies