made the code nicer