remove currentTag variable
remove unused code
style fixes
minor optimization