Some basic refactoring was made.