Improved the source code slightly