code cleanup
updated version