cleaned up code part 2