code cleanup and bootstrap