cleaner code, new function