refactored all the code in order to be consistent in all the files