failed attempt to make code cleaner