making the code more elegant