Fixed issue with undefined being printed before the converted string on webpage. Cleaned up whitespaces and comments.