made the code a bit more simple