fixes and code cleanup..