changed the code a little so we need less lines to do the same thing