Cleanup code part 1