updates and code cleanup