simplified code a bit more