Last bugs removed and code cleanup.