Improved the code documentation. Cleaned-up some parts.