Improved performance by recalculating first/last letter only by request
Added DEBUG_OUTPUT macro - tired of commenting/uncommenting debugging output to stdout