trying to make the code cleaner