Finished code refactoring.