bug fixes and code style fixes, renamed token file