Some code cleanup
fixes