altered code a little, a little more clear