refactor code part 1

Can we make some pair-programming to continually improve this code?