some fixes, cosmetics and optimize.