Code cleaned. Doxygen documentation added. Small fixes.