simplified a function